from enum import Enum
from bcat.api.net.service import Service
from bcat.api.net.session import Session


class ApiCreator(object):
    def make_service(self, handle) -> Service:
        return Service(handle)
    def make_session(self, service, handle, **kwargs) -> Session:
        return Session(service, handle, **kwargs)
    def make_log(self):
        return None


class ApiType(Enum):
    C = 1
    PYTHON= 2

def make_api(api_type):
    if api_type == ApiType.C :
        return CImplCreator()
    else :
        return CImplCreator()


from bcat.api.impl.c.service_impl import ServiceImpl
from bcat.api.impl.c.session_impl import SessionImpl
from bcat.api.impl.c.log_impl import LogImpl


class CImplCreator(ApiCreator):
    def make_service(self, handle) -> Service:
       return ServiceImpl(handle) 

    def make_session(self, service, handle, **kwargs) -> Session:
        return SessionImpl(service, handle, **kwargs)

    def make_log_builder(self): # TODO: extract the logBuilder's interface 
        return LogImpl.Builder()


    

